export default {
	fomartTime:function(timestamp){
		var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
		var Y = date.getFullYear();
		var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1);
		var D = date.getDate() < 10 ? '0'+date.getDate() : date.getDate()
		var h = date.getHours() < 10 ? '0'+date.getHours() : date.getHours();
		var m = date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes();
		var s = date.getSeconds();
		return {
		   day:M + '月' + D + '日',
		   time:h + '：' + m
		}
	},
	now:function(){
	        var myDate = new Date();
		    var year=myDate.getFullYear();    //获取完整的年份(4位,1970-????)
		    var month=myDate.getMonth()+1;       //获取当前月份(0-11,0代表1月)
		    var date=myDate.getDate();        //获取当前日(1-31)
			var nowTime = year+"."+month+"."+date
		    var nowDay = "星期" + "日一二三四五六".charAt(new Date().getDay());
			return {
				nowTime:nowTime,
				nowDay:nowDay
			}
	},
	getPageNum:function(total,num) {
		if(num < total) {
			return 1
		}else {
			const reszult = total / num
			if (total%num == 0) {
				return reszult
			} else {
				return  parseInt(reszult) + 1
			}
		}
	},
	getPing:function(num) {
		if (num == 1) {
			return "优秀"
		}
		if (num == 2) {
			return "合格"
		}
		if (num == 3) {
			return "待合格"
		}
		if (!num) {
			return ""
		}
	},
	getWork:function(str) {
		if (str == 'type_1') {
			return "必选作业"
		}
		if (str == 'type_2') {
			return "选做作业"
		}
		if (str == 'type_3') {
			return "挑战作业"
		}
		if (str == 'type_4') {
			return "实践作业"
		}
	},
	getWorkNum:function(str) {
		if (str == 'type_1') {
			return 0
		}
		if (str == 'type_2') {
			return 1
		}
		if (str == 'type_3') {
			return 2
		}
		if (str == 'type_4') {
			return 3
		}
	}
}

